using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class RoomInfoBinder : CtrlEventHandler
{
    [SerializeField]
    TMPro.TextMeshProUGUI roomName;
    [SerializeField]
    TMPro.TextMeshProUGUI ownerName;
    [SerializeField]
    TMPro.TextMeshProUGUI playerCount;
    [SerializeField]
    UnityEngine.UI.Button btnJoinRoom;
    public override int DataFactoryId => CtrlEventID.ROOM_MANAGER_ID;

    void OnEnable()
    {
        btnJoinRoom.onClick.AddListener(OnJoinRoom);
    }

    private void OnDisable()
    {
        btnJoinRoom.onClick.RemoveListener(OnJoinRoom);
    }

    void OnJoinRoom()
    {

    }

    public override void Bind(object data)
    {
        if(data is RoomInfoData roomData)
        {
            roomName.text = roomData.roomName;
            ownerName.text = roomData.roomName;
            playerCount.text = $"{roomData.playerCount}/2";
        }
    }
}
